#include <stdio.h>
#include <stdlib.h>
#include "stack.h"
#include "myoperate.h"
#include "rpn.h"

//gcc main.c rpn.h rpn.c stack.h stack.c myoperate.h myoperate.c -o test.exe

int main(){
    char input[MAX_EXPRESSION_SIZE];

    while(1){
        printf("please input the formula:\n");

        scanf("%s",input);
        if( strcmp(input,"exit") == 0 ) break;

        char *ans = last_to_ans( middle_to_last( input ) );
// printf("%s\n",middle_to_last( input ));
        printf("the answer is:%s\n\n",ans);
    }

    printf("exit successfully");
    return 0;
}